
interface Animal{
        void cry();
        String getAnimalName();
}
class Cat implements Animal{
      String name = "猫";
        @Override
        public void cry() {
                System.out.println(getAnimalName() +"在喵喵叫");
        }
        @Override
        public String getAnimalName() {
                return this.name;
        }

}
class  Dog implements  Animal {
String name = "狗";
        @Override
        public void cry() {
                System.out.println(getAnimalName() +"在旺旺叫");
        }

        @Override
        public String getAnimalName() {
                return this.name;
        }
}

public class Simulator {
        public static void main(String[] args) {
                Simulator simulator = new Simulator();

                simulator.playSound(new Dog());

                simulator.playSound(new Cat());
        }
        public void playSound(Animal animal){
               animal.cry();
        }


}